package com.pdg.islandinterloper.database.objects;

import android.database.Cursor;

public class Island {
	
	private static final int COLUMN_ID = 0;
	private static final int COLUMN_ISLAND_NAME = 1;
	private static final int COLUMN_ISLAND_X = 2;
	private static final int COLUMN_ISLAND_Y = 3;
	private static final int COLUMN_PROFILE_ID = 4;
	private static final int COLUMN_NATION_ID = 5;
	private Long id;
	private String islandName;
	private WorldPosition islandPosition = new WorldPosition();
	private Long profileId;
	private Long nationId;
	public Island(String theIslandName,WorldPosition theIslandPosition,Long theProfileId,Long theNationId){
		setId(null);
		setIslandName(theIslandName);
		getIslandPosition().setX(theIslandPosition.getX());
		getIslandPosition().setY(theIslandPosition.getY());
		setProfileId(theProfileId);
		setNationId(theNationId);
	}
	public Island(Cursor theCursor){
		setId(theCursor.getLong(COLUMN_ID));
		setIslandName(theCursor.getString(COLUMN_ISLAND_NAME));
		getIslandPosition().setX(theCursor.getDouble(COLUMN_ISLAND_X));
		getIslandPosition().setY(theCursor.getDouble(COLUMN_ISLAND_Y));
		setProfileId(theCursor.getLong(COLUMN_PROFILE_ID));
		if(theCursor.isNull(COLUMN_NATION_ID)){
			setNationId(null);
		}else{
			setNationId(theCursor.getLong(COLUMN_NATION_ID));
		}
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getIslandName() {
		return islandName;
	}
	public void setIslandName(String islandName) {
		this.islandName = islandName;
	}
	public Long getProfileId() {
		return profileId;
	}
	public void setProfileId(Long profileId) {
		this.profileId = profileId;
	}
	public Long getNationId() {
		return nationId;
	}
	public void setNationId(Long nationId) {
		this.nationId = nationId;
	}
	public WorldPosition getIslandPosition() {
		return islandPosition;
	}
}
